/*** Eclipse Class Decompiler plugin, copyright (c) 2016 Chen Chao (cnfree2000@hotmail.com) ***/
package Deal;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class NetUtils {
	public static byte[] readBytes(InputStream is) {
		try {
			byte[] e = new byte[1024];
			boolean len = true;
			ByteArrayOutputStream baos = new ByteArrayOutputStream();

			int len1;
			while ((len1 = is.read(e)) != -1) {
				baos.write(e, 0, len1);
			}

			baos.close();
			return baos.toByteArray();
		} catch (Exception arg3) {
			arg3.printStackTrace();
			return null;
		}
	}

	public static String readString(InputStream is) {
		return new String(readBytes(is));
	}

	public static boolean isMobileNO(String mobiles) {
		Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
		Matcher m = p.matcher(mobiles);
		return m.matches();
	}

	public static boolean isEmail(String email) {
		String str = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
		Pattern p = Pattern.compile(str);
		Matcher m = p.matcher(email);
		return m.matches();
	}
}